cmake_minimum_required(VERSION 3.1)

project(myptm CXX C)

add_library(myptm STATIC
    src/ttds_core.c
    src/ttds_timer.c
    src/ttds_message_queue.c
    src/ttds_cjobq.c
    src/ttds_cotask.c
    )

target_include_directories(myptm PUBLIC include )
target_compile_options(myptm PUBLIC -g -O0 )

add_executable(cotest
    coroutines/co_test.c
    )

add_executable(cotest2
    coroutines/co_test2.c
    )

add_executable(coroutine_example1 
    coroutines/example1.cpp
    src/ttds_cotask.c
    src/ttds_timer.c
    src/ttds_cjobq.c
)

target_include_directories(coroutine_example1 PUBLIC include )

if(CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(coroutine_example1 PUBLIC stdc++)
target_compile_options(coroutine_example1 PUBLIC -O0 -g)
#target_link_options(coroutine_example1 PUBLIC -Wl,--stack=0x500000 )
target_compile_definitions(coroutine_example1 PUBLIC -D_FORTIFY_SOURCE=0 )
endif()

if (MSVC)
target_link_options(coroutine_example1 PUBLIC /STACK:0x500000 )
endif()

add_subdirectory(test)

